#include "time.h"

void time1_init(void)
{
	//Interrupt Overfolw enable
	TIME1_INT_ENAMBE();	
	
	//Setzen des Prescaler auf 1024 
	TIME1_PRESCALER();

	TIME1_ZAELEN = 65535 - (F_CPU / 1024);
}


bool zeit_vergangen(unsigned short sekunde)
{
	static unsigned short ss=0;
	if(ss==sekunde)
	{
		ss=0;
		return true;
	}
	else
	{
		ss++;
		return false;
	}
}


ISR(TIMER1_INT)
{
	
	TIME1_ZAELEN = 65535 - (F_CPU / 1024);
	
	if(zeit_vergangen(10)) 
	{	
		//bei differenz von 0,4g senden
		if(beschleunigung(400)) rf02_senden();  
		
	}

}
